Conversation
|
|
||
| # flip the y axis so that y grows upwards | ||
| node = Group(self.nodes) | Scale(sx=1, sy=-1) | ||
| node = Group(self.nodes) |
There was a problem hiding this comment.
I don't think replacing y to -y wherever it is used for avoiding this transformation is a good idea. Right now we don't maintain the exact attributes used to create a shape, but we would like to do that at some point.
I think it would better to apply scale(y=-1) to text shape to compesate for this.
| >>> t = text("Hello!", center=Point(x=100, y=100), alignment_baseline="middle", text_anchor="middle") | ||
| >>> show(t) | ||
| """ | ||
| def __init__(self, content, anchor=Point(0, 0), **kwargs): |
There was a problem hiding this comment.
This API is inconsitent with other shapes. We typically use x and y attributes to specify position instead of a Point.
For example: circle(x=100, y=100)
I think it would be better to use it as text("Hello", x=100, y=100)
| show(t) | ||
|
|
||
| """ | ||
| return Text(content, anchor=Point(x=x, y=-y), **kwargs) |
There was a problem hiding this comment.
Ah, I see that you've retained the interface of using x and y here.
| ``` | ||
| c = circle(x=-100, y=0, r=50) | ||
| shape = c | Repeat(10, Translate(x=10, y=0) | ||
| shape = c | repeat(10, translate(x=10, y=0) |
There was a problem hiding this comment.
This change is not related to adding text node. Could you please remove this change from this PR?
|
Thanks @asteppke for the PR. I've added some comments. Please review. |
In the first commit the flip transformation of the y-axis is exchanged by a sign change of all given y coordinates. This allows upright text.
Then we can add a basic text node relatively straightforward. Of course I am looking forward for any feedback!